package aor2;

import aor2.components.AlushiftOperation;
import aor2.cpu.InternBus;
import aor2.cpu.blockoperation.AlushiftXYM1;
import aor2.cpu.blockregisters.GPRegisters;
import aor2.cpu.blockregisters.InstructionSignal;

public class TestClass1 {

	static AlushiftXYM1 alu = AlushiftXYM1.getInstance();

	static void info() {
		System.out.println("==========================");
		System.out.println(InstructionSignal.info());
		System.out.println(InternBus.info());
		System.out.println(GPRegisters.info());
		System.out.println(alu);
		System.out.println("==========================");
	}

	static void clearSignals() {
		InternBus.clear();
		alu.clearOperation();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		System.out.println("begin");
		info();

		InstructionSignal.setActive();
		// R7->X
		System.out.println("R7out, Xin");
		clearSignals();
		GPRegisters.R7.out();

		info();

		alu.inX();

		// inc(X)->R2
		System.out.println("R2in, inc, ALUSHIFTout");
		clearSignals();
		alu.setOperation(AlushiftOperation.inc);
		alu.out();

		info();

		GPRegisters.R2.in();

		// R2->X
		System.out.println("R2out, Xin");
		clearSignals();
		GPRegisters.R2.out();

		info();

		alu.inX();

		// shl(X)->R3
		System.out.println("R3in, shl, ALUSHIFTout");
		clearSignals();
		alu.setOperation(AlushiftOperation.shl);
		alu.out();

		info();

		GPRegisters.R3.in();

		// R3->Y
		System.out.println("R3out, Yin");
		clearSignals();
		GPRegisters.R3.out();

		info();

		alu.inY();

		// add(X,Y)->R4
		System.out.println("R4in, add, ALUSHIFTout");
		clearSignals();
		alu.setOperation(AlushiftOperation.add);
		alu.out();

		info();

		GPRegisters.R4.in();

		System.out.println("end");
		clearSignals();
		info();

	}

}
